package tests;

import java.lang.reflect.Array;

import tester.*;
import tester.utilities.TesterUtility;

@Example
public class MultiDimensionalArray {
	
	public MultiDimensionalArray(){}
	
	@TestMethod
	public void check(Tester t){
		int[] sizes = new int[20];
		for(int i = 0; i < sizes.length; i++){
			sizes[i] = 2;
		}
		Object zoo = Array.newInstance(Integer.TYPE, sizes);
		System.out.println("Size: " + Array.getLength(zoo));
		
		int[][][] foo = new int[2][2][2];
		int[][][] bar = new int[2][2][2];
		for(int i = 0; i < 2; i++){
			for(int j = 0; j < 2; j++){
				for(int k = 0; k < 2; k++){
					foo[i][j][k] = i + j + k;
					bar[i][j][k] = i + j + k + 10000;
				}
			}
		}
		
		t.checkFail(foo, bar);
		
		int[][][] fooCopy = TesterUtility.objectCopy(foo);
		t.checkExpect(foo, fooCopy);
		t.checkFail(fooCopy, bar);
		
	}
	
	public static void main(String[] args){
		Tester.run(new MultiDimensionalArray());
	}
	
}
